import request from "@/utils/request";
import cfg from "@/config/config";

const tree = {
  //部门树
  getDeptTree: param => {
    return request("get", cfg.apiUrl + "api/dept/tree", param);
  },
  //场所树
  getPlaceTree: param => {
    return request("get", cfg.apiUrl + "api/place/tree", param);
  },
  getZTree: param => {
    return request("get", cfg.apiUrl + "api/dept/tree/zTree", param);
  },
  //获取2级部门数据
  run: param => {
    return request("get", cfg.apiUrl + "api/dept/tree/findDepList", param);
  },
  //部门配置--新增部门 参数：{"depName":"部门名称","depParent":"父级ID"}
  addDtDep: param => {
    return request("post", cfg.apiUrl + "api/dept/addDtDep", param);
  },
  //部门配置--修改部门 参数：{"depSerial":"部门名称","depParent":"父级ID"}
  updateDtDep: param => {
    return request("post", cfg.apiUrl + "api/dept/updateDtDep", param);
  },
  //部门配置--表格树
  getAgTree: param => {
    return request("get", cfg.apiUrl + "api/dept/agTree", param);
  },
  //部门配置--删除表格树节点（逻辑删除）
  deleteDtDep: param => {
    return request("post", cfg.apiUrl + "api/dept/deleteDtDep", param);
  }
};

export default tree;
